home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Mac Parts / Views / Panes / Pane.cp < prev    next >
Text File  |  2000-06-23  |  957b  |  52 lines

  1. // Pane.cp
  2.  
  3. #ifndef Pane_h
  4. #include "Pane.h"
  5. #endif
  6. #ifndef ViewCell_h
  7. #include "ViewCell.h"
  8. #endif
  9. #ifndef Canvas_h
  10. #include "Canvas.h"
  11. #endif
  12.  
  13. Pane::Pane( const DrawsSpontaneously *theParent )
  14.   : parent( theParent ),
  15.      content( &ViewCell::Blank() ),
  16.      viewLink( this )
  17.   {
  18.   }
  19.  
  20. Pane::~Pane()
  21.   {
  22.   }
  23.  
  24. void Pane::Clear()
  25.   {
  26.     content = &ViewCell::Blank();
  27.     if ( viewLink.Owned() )
  28.         viewLink.Owner().Remove( viewLink );
  29.   }
  30.         
  31. void Pane::SetContent( View& view,
  32.                               DrawsSpontaneously *drawsSpontaneously )
  33.   {
  34.     if ( viewLink.Owned() )
  35.         viewLink.Owner().Remove( viewLink );
  36.     
  37.     content = &view;
  38.     
  39.     if ( drawsSpontaneously != 0 )
  40.         drawsSpontaneously->panes.Add( viewLink, afterEnd );
  41.   }
  42.  
  43. void Pane::Deliver( CellVisitor& visitor,
  44.                               const Canvas& parentCanvas,
  45.                               Canvas& scratchCanvas ) const
  46.   {
  47.     scratchCanvas = parentCanvas;
  48.     Adjust( scratchCanvas );
  49.     if ( scratchCanvas.Visible() )
  50.         content->Deliver( visitor, scratchCanvas );
  51.   }
  52.